﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.AuditLogging;

namespace PHMEE.BackgroundJobs
{
    public class AuditLogClearJob : IBackgroundJob
    {
        private readonly IAuditLogRepository auditLogRepository;

        public AuditLogClearJob(IAuditLogRepository auditLogRepository)
        {
            this.auditLogRepository = auditLogRepository;
        }


        public async Task ExcuteAsync()
        {
            // 默认删除一年前的数据
            await auditLogRepository.DeleteDirectAsync(item => item.ExecutionTime < DateTime.Now.AddYears(-1));
        }
    }
}
